<?php 

header("Content-type: text/html; charset=utf-8");

if($_FILES['file']['size']>300000){
	echo "不允许上传";
	exit;
}

$allowArr = ['jpg','png','gif'];

$arr = explode('.', $_FILES['file']['name']);  //把字符转换为数组

$type = end($arr);

$name = uniqid();

if(!in_array($type, $allowArr)){
	echo "你上传的文件不符合要求";exit;
}

var_dump($_FILES);

move_uploaded_file($_FILES['file']['tmp_name'], './img/'.$name.'.'.$type);


echo "shangchuangchenggong";




 ?>